<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
      #wrap {
        border: 1px solid;
      }
      #inner {
        float: left;
        width: 200px;
        height: 200px;
        background: pink;
      }
      /*开启haslayout*/
      .clearfix {
        *zoom: 1;
      }
      /*ie6 7 不支持伪元素*/
      .clearfix:after {
        content: '';
        display: block;
        clear: both;
        height:0;
        line-height:0;
        visibility:hidden;
      }
</style>
<body>
    <!-- 清除浮动：
        1,触发BFC overflow：hidden
        2,伪类选择器
        3,最后增加一个块级元素clear：both；
        4,<br clear=all/>
    -->
    <div id="wrap" class="clearfix">
        <div id="inner"></div>
    </div>
</body>
</html>